﻿$.extend({

    Nasa8x: {

        switchView: function (_v) {

            if (_v) {

                $.Cookie.add('__view', _v);
            }
            else {
                _v = $.Cookie.get('__view');
            };

            if (!$.String.isNullOrEmpty(_v)) {
                $('li.view-type').removeClass("actived");
                $('#view-' + _v).addClass('actived');
                $('#_listPanel').removeClass().addClass(_v + '-view');
            }

        },


        cmd: function (c, o) {
            $("#cmd").val(c);
            $.Ajax.submit('_fcmd', o);
        },

        showActionArea: function () {
            $('#detail-actions-area-container').slideDown();
        },

        closeActionArea: function () {

            $('#detail-actions-area-container .child').attr('rel', 0);
            $('#detail-actions-area-container').slideUp();
        },

        share: function (title, url) {

            var _el = $('#shareIt');
            if (_el.attr('rel') != 1) {
                _el.attr('rel', 1).show();
                $.shareIt.show({ title: title, url: url });
                this.showActionArea();
            }
            else {
                _el.hide();
                this.closeActionArea();
            }

        },

        report: function () {

            var _el = $('#reportIt');
            if (_el.attr('rel') != 1) {
                _el.attr('rel', 1).show();
                this.showActionArea();
            }
            else {
                _el.hide(); this.closeActionArea();
            }


        }



    }


});


$(document).ready(function () {
    $.Nasa8x.switchView();
});

